package com.zhu;

import com.zhu.config.GuavaCacheManager;
import com.zhu.utils.PLCDataReader;
import com.zhu.vo.PlcResVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class CommonController {


    @Autowired
    GuavaCacheManager<String, String> cacheManager;


    @Autowired
    AreaService areaService;

    @Autowired
    PLCDataReader plcDataReader;

    @GetMapping("/plcDataReader")
    public Result plcDataReader() {
        final List<PlcResVO> plcResVOS = plcDataReader.readPLCData1();
        return Result.success(plcResVOS);
    }


    @GetMapping("/getAreaList")
    public Result getAreaList() {
        final Map<String, Object> areaList = areaService.getAreaList();
        return Result.success(areaList);
    }


}
